USE [DYBBERPDB] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fun_GetPickupStatusStatus]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT')) DROP FUNCTION [dbo].[fun_GetPickupStatusStatus] GO CREATE function [dbo].[fun_GetPickupStatusStatus](@status int,@productCount int) /****** 获取取件状态 创建人:刘工 创建日期:2015-09-22 修改人: 修改说明: 修改日期: ******/ Returns varchar(50) As Begin Declare @Return varchar(50) set @Return = '未取' if @status= @productCount and @status>0 begin set @Return = 'OK' end else if @status>0 and @status< @productCount begin set @Return = '部分取件' end Return @Return End GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fun_GetCompletedStatus]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT')) DROP FUNCTION [dbo].[fun_GetCompletedStatus] GO CREATE function [dbo].[fun_GetCompletedStatus](@status int,@productCount int) /****** 获取齐件状态 创建人:刘工 创建日期:2015-09-22 修改人: 修改说明: 修改日期: ******/ Returns varchar(50) As Begin Declare @Return varchar(50) set @Return = '未完' if @status= @productCount and @status>0 begin set @Return = 'OK' end else if @status>0 and @status< @productCount begin set @Return = '部分完件' end Return @Return End GO